<#assign home="active">
<#include "header.ftl">

<article class="content">
  <div class="col-xs-12">
    <h4 class="title">仪表盘</h4>
  </div>
  <div class="col-xs-12">
    <div class="col-lg-3 col-sm-6 col-xs-12">
      <div class="box-min" style="background-image: url('${root}/static/images/mem.png')">
        <div style="height: 60px;">
          <p>当前报名<b>${num!'0'}</b>人</p>
          <div style="padding-top: 15px;">
            <button class="btn btn-xs btn-danger"
                    v-if="canReg" @click="switchReg(0)">关闭报名</button>
            <button class="btn btn-xs btn-info"
                    v-if="!canReg" @click="switchReg(1)">开启报名</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</article>
<script>
  var hv = new Vue({
    el: '.content',
    data: {
      canReg: ${canReg?string("true","false")}
    },
    methods: {
      switchReg: function (can) {
        var self = this;
        $.post('${root}/sys/reg/' + can, function (data) {
          if (data.success) {
            self.canReg = (can === 1);
          }
        });
      }
    }
  });
</script>
<#include "footer.ftl">